package com.xbongbong.pro.domain.dao;

import com.xbongbong.pro.domain.entity.FormConfigEntity;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author feng.zheng
 * @version v1.0
 * @date 2019/5/21 14:23
 * @since v1.0
 */

public interface FormConfigDao {
    Integer insert(FormConfigEntity formConfigEntity);

    Integer insertBatch(@Param("list") List<FormConfigEntity> paasFormList);

    Integer update(FormConfigEntity formConfigEntity);

    //void insertBatch(List<FormConfigEntity> formConfigEntityList);

    Integer deleteByKey(@Param("key") Long key, @Param("corpid") String corpid);

    FormConfigEntity getByKey(@Param("key") Long key, @Param("corpid") String corpid);

    List<FormConfigEntity> findEntitys(@Param("param") Map<String, Object> param);

    Integer getEntitysCount(@Param("param") Map<String, Object> param);

    Integer deleteBatch(@Param("idIn")List<Long> idIn, @Param("corpid")String corpid);

    FormConfigEntity getEntityByFormId(@Param("corpid") String corpid, @Param("formId") Long formId, @Param("config") String config);

    List<FormConfigEntity> getButtonEntityByFormId(@Param("corpid") String corpid, @Param("formId") Long formId,@Param("configList") List<String> configList);

    FormConfigEntity getEntityByBusinessType(@Param("corpid") String corpid, @Param("businessType") Integer businessType, @Param("config") String config);

    void updateBatch(@Param("list") List<FormConfigEntity> updateConfigList, @Param("corpid") String corpid);

    /**
     * 更新表单模板的查重配置
     * @author xingxing.xiao
     * @param param
     * @return
     */
    Integer updateRepeatType(@Param("param") Map<String, Object> param);

    /**
     * 获取表单的配置
     * @param config
     * @param corpid
     * @param formId
     * @param saasMark
     * @param businessType
     * @return
     */
    FormConfigEntity getByConfig(@Param("config") String config, @Param("corpid") String corpid, @Param("formId") Long formId, @Param("saasMark") Integer saasMark, @Param("businessType") Integer businessType);
}
